package com.ly.heart.domain.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Date;
import java.util.Objects;

/**
 * 流程审批信息返回Vo
 * @author cxl
 */
@Data
@Accessors(chain = true)
public class ActTaskCommentVo {

    @ApiModelProperty ("实例id")
    private String instanceId;

    @ApiModelProperty ("任务id")
    private String taskId;

    @ApiModelProperty ("任务名称")
    private String taskName;

    @ApiModelProperty ("审核人id")
    private String assignee;

    @ApiModelProperty ("审核人名称")
    private String assigneeName;

    @ApiModelProperty ("审核结果(0通过 1拒绝 2回退)")
    private String comments;

    @ApiModelProperty ("审核结果(0通过 1拒绝 2回退)")
    private String commentsName;

    @ApiModelProperty ("备注")
    private String remark;

    @ApiModelProperty ("创建时间")
    @JsonFormat( pattern = "yyyy-MM-dd HH:mm:ss" )
    private Date createTime;

    public ActTaskCommentVo setCommentsName(String comments){
        if(Objects.nonNull(comments)){
            switch (comments){
                case "0":
                    commentsName = "通过";
                    break;
                case "1":
                    commentsName = "拒绝";
                    break;
                case "2":
                    commentsName = "回退";
                    break;
            }
        }
        this.comments = comments;
        return this;
    }


}
